//
//  RSLocationManager.h
//  StaffTax
//
//  Created by 侯伟 on 2021/3/4.
//  Copyright © 2021 侯伟. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
NS_ASSUME_NONNULL_BEGIN

/**
 单次定位回调
 */
typedef void (^RSLocationManagerCompletionBlock)(CLLocation *location, NSError *error);

@class RSLocationManager;
@protocol RSLocationManagerDeletate<NSObject>

/**
 位置更新

 @param manager -
 @param reGeocode -
 */
@optional
-(void)locationManager:(RSLocationManager *)manager didUpdateLocation:(CLLocation *)location;
/**
 权限改变

 @param manager manager description
 @param status status description
 */
@optional
-(void)locationManager:(RSLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status;

/**
 位置更新失败

 @param manager -
 @param error -
 */
@optional
-(void)locationManager:(RSLocationManager *)manager didUpdateLocationFailed:(NSError*)error;

@end


@interface RSLocationManager : NSObject



@property(nonatomic, assign) id<RSLocationManagerDeletate> delegate;

/**
 是否正在连续定位
 */
@property (nonatomic,assign,readonly)BOOL isLocation;

/**
 当前定位权限
 */
@property (nonatomic,assign,readonly)CLAuthorizationStatus authStatus;

/**
 当前定位信息
 */
@property(nonatomic,strong,readonly)CLLocation* currentLocation;

/**
 最小定位距离b
 */
@property (nonatomic, assign)NSInteger distanceFilter;

/**
 是否会被系统自动暂停
 */
@property (nonatomic,assign)BOOL pausesLocationUpdatesAutomatically;

/**
 设定期望的定位精度
 */
@property(nonatomic, assign) CLLocationAccuracy desiredAccuracy;

/**
 是否允许后台定位
 */
@property(nonatomic, assign) BOOL allowsBackgroundLocationUpdates;

/// 位置回调
@property(nonatomic, copy) RSLocationManagerCompletionBlock locationChangedBlock;


/**
 是否显示定位权限提醒
 */
@property(nonatomic, assign,readonly) BOOL isAlert;

/**
 *  单例模式
 */
+ (instancetype)sharedInstance;

/**
 *  开始连续定位
 */
- (void)startUpdatingLocation;

/**
 *  结束定位
 */
- (void)stopUpdatingLocation;

/**
 *  @brief 开始获取设备朝向，如果设备支持方向识别，则会通过代理回调方法
 */
- (void)startUpdatingHeading;

/**
 *  @brief 停止获取设备朝向
 */
- (void)stopUpdatingHeading;


@end

NS_ASSUME_NONNULL_END
